home *** CD-ROM | disk | FTP | other *** search
/ Visual Cafe 3 / Visual Cafe 3.ISO / Vcafe / Main.bin / FilterWriter.java < prev    next >
Text File  |  1998-09-22  |  2KB  |  95 lines

  1. /*
  2.  * @(#)FilterWriter.java    1.6 98/07/01
  3.  *
  4.  * Copyright 1995-1998 by Sun Microsystems, Inc.,
  5.  * 901 San Antonio Road, Palo Alto, California, 94303, U.S.A.
  6.  * All rights reserved.
  7.  * 
  8.  * This software is the confidential and proprietary information
  9.  * of Sun Microsystems, Inc. ("Confidential Information").  You
  10.  * shall not disclose such Confidential Information and shall use
  11.  * it only in accordance with the terms of the license agreement
  12.  * you entered into with Sun.
  13.  */
  14.  
  15. package java.io;
  16.  
  17.  
  18. /**
  19.  * Abstract class for writing filtered character streams.
  20.  *
  21.  * @version     1.6, 98/07/01
  22.  * @author    Mark Reinhold
  23.  * @since    JDK1.1
  24.  */
  25.  
  26. public abstract class FilterWriter extends Writer {
  27.  
  28.     /**
  29.      * The underlying character-output stream.
  30.      */
  31.     protected Writer out;
  32.  
  33.     /**
  34.      * Create a new filtered writer.
  35.      */
  36.     protected FilterWriter(Writer out) {
  37.     super(out);
  38.     this.out = out;
  39.     }
  40.  
  41.     /**
  42.      * Write a single character.
  43.      *
  44.      * @exception  IOException  If an I/O error occurs
  45.      */
  46.     public void write(int c) throws IOException {
  47.     out.write(c);
  48.     }
  49.  
  50.     /**
  51.      * Write a portion of an array of characters.
  52.      *
  53.      * @param  cbuf  Buffer of characters to be written
  54.      * @param  off   Offset from which to start reading characters
  55.      * @param  len   Number of characters to be written
  56.      *
  57.      * @exception  IOException  If an I/O error occurs
  58.      */
  59.     public void write(char cbuf[], int off, int len) throws IOException {
  60.     out.write(cbuf, off, len);
  61.     }
  62.  
  63.     /**
  64.      * Write a portion of a string.
  65.      *
  66.      * @param  str  String to be written
  67.      * @param  off  Offset from which to start reading characters
  68.      * @param  len  Number of characters to be written
  69.      *
  70.      * @exception  IOException  If an I/O error occurs
  71.      */
  72.     public void write(String str, int off, int len) throws IOException {
  73.     out.write(str, off, len);
  74.     }
  75.  
  76.     /**
  77.      * Flush the stream.
  78.      *
  79.      * @exception  IOException  If an I/O error occurs
  80.      */
  81.     public void flush() throws IOException {
  82.     out.flush();
  83.     }
  84.  
  85.     /**
  86.      * Close the stream.
  87.      *
  88.      * @exception  IOException  If an I/O error occurs
  89.      */
  90.     public void close() throws IOException {
  91.     out.close();
  92.     }
  93.  
  94. }
  95.